package 门牌制作592;

public class Main {
	public static void main(String[] args) {
		int tmp=0;
		for(int i=1;i<=2020;i++) {
			int numString=i;
			while(numString>0) {
				int add=numString%10;
				if(add==2) {
					tmp++;
				}
				numString/=10;
			}
		}
		System.out.println(tmp);
	}
}
